package com.lemontree.servlet;

import java.io.IOException;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.lemontree.serviceImpl.BicyleServiceImpl;
import com.lemontree.serviceImpl.CarServiceImpl;

/**
 * Servlet implementation class Del
 */
public class Del extends HttpServlet {
	private static final long serialVersionUID = 1L;
       
    /**
     * @see HttpServlet#HttpServlet()
     */
    public Del() {
        super();
        // TODO Auto-generated constructor stub
    }

	/**
	 * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response)
	 */
	protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		
		BicyleServiceImpl b = new BicyleServiceImpl();
		CarServiceImpl c = new CarServiceImpl();
		
		String flag = request.getParameter("flag");
		String id = request.getParameter("id");
		
		if(flag.equals("1")){
			b.delBicyle(id);
		}else{
			c.delCar(id);
		}
		
	}

	/**
	 * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response)
	 */
	protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		// TODO Auto-generated method stub
		doGet(request, response);
	}

}
